package com.smt.ejb3.tutoria.webservice.impl;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;

import com.smt.ejb3.tutoria.entitybean.Order;
import com.smt.ejb3.tutoria.webservice.OrderService;

@WebService(targetNamespace = "http://ws.smt.cn", name = "OrderService", 
		serviceName = "OrderServiceBean")
@Stateless
@Remote(OrderService.class)
public class OrderServiceBean implements OrderService {

	@WebMethod
	public String getUserName(String name) {
		return name;
	}

	@WebMethod
	public Order getOrder(String orderId) {
		Order order = new Order();
		order.setOrderId(orderId);
		order.setName("Tom");
		return order;
	}

	@WebMethod
	public List<Order> getOrders() {
		List<Order> orders = new ArrayList<Order>();
		Order order1 = new Order();
		order1.setOrderId("001");
		order1.setName("Tom");
		Order order2 = new Order();
		order2.setOrderId("002");
		order2.setName("Jerry");
		orders.add(order1);
		orders.add(order2);
		return orders;
	}

}
